package com.slz3.business.module.configManagement.conZoneType.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conZoneType.domain.ConZoneType;
import com.slz3.business.module.configManagement.conZoneType.domain.ConZoneTypeFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConZoneTypeTransactionalServiceImpl implements ConZoneTypeTransactionalService {

    @Override
    public ConZoneType modify(ConZoneType conZoneTypeNew) {
        Repositorys.conZoneType.test();
        Repositorys.conZoneType.save(ConZoneTypeFactory.initBaseFields());
        System.err.println(1/0);
        conZoneTypeNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conZoneType.saveAndFlush(conZoneTypeNew);
    }

    @Override
    public List<ConZoneType> batchModify(List<ConZoneType> conZoneTypeList) {
        return Repositorys.conZoneType.saveAll(conZoneTypeList);
    }
}
